import MDP
import config
from mdcliapi import MajorClient

########################################
def main():
    broker_server = "%s://%s:%d" % (config.PROTOCOL, config.GW_IP, config.CLIENT_PORT)
    client = MajorClient(broker_server, "echo")

    requests = 3
    for i in xrange(requests):
        request = "Hello world %d" % (i, )
        client.send(MDP.W_CLIENT_REQ, request)

    while 1:
        reply = client.recv()
        if reply is not None:
            print "reply: ", reply.uid, reply.cmd, reply.msg, reply.extra

########################################
if __name__ == '__main__':
    main()

########################################
